#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>

#define BUFFSIZE 4096

/*
 * Duplicate standard input to standard output
 */

int main() {
	int n;
	char buf[BUFFSIZE];

	while ((n=read(STDIN_FILENO,buf,BUFFSIZE)) > 0) 
		if (write(STDOUT_FILENO,buf,n) != n) {
			printf("write error: %s\n",strerror(errno));
			return -1;
		}

	if (n<0)	{
		printf("read error: %s\n",strerror(errno));
		return -1;
	}

	return 0;
}